Overall Objective

Determine the concentration of total exosomes throughout pregnancy in WT mated C57/B6 mice. Time points for the study included Virgin (day 1), gestational day (G.D) 5.5, 10.5, 14.5, 17.5 and 1 day post partum (day 20). six animals were used for each of the six time points in the study. A volume of 100ul of plasma was obtained by means of cardiac puncture or deeply anesthetized animals. Plasma exosomes were isolated using the total exosome isolation reagent (ThermoFisher) and resuspended in 30ul of PBS. Samples were then blinded (randomly assigned numbers) and analzed by Nanosight (NS300 Malvern) nanoparticle tracking analysis. For each day of nanosight analysis, one sample from each of the time points was chosen and analyzed by Nanosight. Before and after samples were analyzed, 100nm polystyrene bead standards were analyzed (1:125 in PBS) to determine intra and inter assay variability.

Nanosight measurement/ experimental setup

Samples and standards were measured twice by two separate injections (from separate tubes) into the machine. Three, thirty second 30 second videos were recorded and analyzed by Nanosight NTA 3.2 and exported raw data was exported as a .csv file which was minimally processed for easy import into R.

Nanosight acquisition settings

Gain Level Threshold
Standards 1 11 4
Samples 1 12 4

Load Libraries

library(tidyverse)
library(cowplot)
library(broom)
library(pwr)
library(plotly)

Import data

There are total of three datasets that will be used for this experiment. The raw data from all the samples, the 100nm standards to determine the inter and intra-assay variation as well as the timecourse data that serves as the ‘key’ to identify Sample_ID to the experiment condition.

setwd("~/GitHub/time-course/data")
#setwd("~/Library/Mobile\ Documents/com~apple~CloudDocs/time-course/data")

rawdata <- "revised_MASTER-ExperimentSummary.csv"
timecourse <- "timecourse2017.csv"
standards <- "standards_MASTER-ExperimentSummary.csv"


data <- read_csv(rawdata)
tc <- read_csv(timecourse, na = c("","NA"))
std <- read_csv(standards)

Convert data from ‘wide’ to ‘long’ format

The data is in the classical ‘wide’ format which is easy to understand from a human cognition perspective but we need to make it ‘long’ so it’s easier to process in R.

data1 <- data %>%
  gather(Sample,Count,2:256)

# Separate samples by identifiers 
data2 <- data1 %>% 
  separate(Sample, into=c("Sample_ID","Dilution_factor","Injection","Tech_rep", sep = "_")) %>% 
  select(-`_`)


std1 <- std %>% 
  gather(Sample,Count,2:82)

std2 <- std1 %>% 
  separate(Sample, into=c("Sample_ID","When","Dilution_factor","Nano_day","Injection","Tech_Rep", sep = "_")) %>% 
  select(-`_`)


std2$Sample_ID <- as.factor(std2$Sample_ID)
std2$When <- as.factor(std2$When)
std2$Dilution_factor <- as.numeric(std2$Dilution_factor)
std2$Injection<- as.factor(std2$Injection)
std2$Nano_day <- as.numeric(std2$Nano_day)

Backcalculate standards

Obtain the ‘True_count’ by multiplying the ‘Count’ column by the ‘Dilution factor’

std2 <- std2 %>% 
  mutate(True_Count=Dilution_factor*Count)

std2$Nano_day <-  factor(std2$Nano_day, levels=c('1','2','3','4','5','6','7'))
std2$When <- factor(std2$When, levels=c('before','after'))

Summarize three technical replicates

std3 <- std2 %>% 
  group_by(particle_size,Sample_ID,When,Dilution_factor,Nano_day,Injection) %>% 
  summarise( tech_N = length(True_Count),
             tech_mean = mean(True_Count),
             tech_sd = sd(True_Count),
             tech_se = tech_sd/sqrt(tech_N))
std3

Summarize by injection

std4 <- std3 %>% 
  group_by(Nano_day,When,particle_size) %>% 
  summarise( inj_N = length(tech_mean),
             inj_mean = mean(tech_mean),
             inj_sd = sd(tech_mean),
             inj_se = inj_sd/sqrt(inj_N))
std4

Plot before and after plots, facet by experimental day

std_day <- std4 %>% 
  ggplot(aes(x=particle_size,y=inj_mean,color=When))+
  geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\n100nm standards")+ #title
  labs(color="Condition")+ #Label table title
  facet_grid(. ~ Nano_day)
std_day

###Plot facet by when and experimental day

std_day_facet <- std4 %>% 
  ggplot(aes(x=particle_size,y=inj_mean,color=When))+
  geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\n100nm standards")+ #title
  labs(color="Condition")+ #Label table title
  facet_grid(When ~ Nano_day)
std_day_facet
## Warning: Removed 1000 rows containing missing values (geom_path).

Particle concentrations from each experimental day

std_df <- std4 %>% 
  group_by(Nano_day,When) %>% 
  summarise(total=sum(inj_mean))
std_df

Bar graph of particle concentrations

std_bar_plot <- std_df %>% 
  ggplot(aes(x=Nano_day,y=total,fill=When))+
  geom_col(position="dodge")+
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Experimental Day") + # X axis label
  ylab("\nMean Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\n100nm standards")+ #title
  labs(color="When") #Label table title

std_bar_plot

# ggsave(plot = std_bar_plot, "std_bar_plot.png",
#        height = 5, width = 7, dpi = 300, units= "in")

Intraassay variability

Intra.assay_cv <- std_df %>% 
  group_by(Nano_day) %>% 
  summarise(Day_N = length(total),
             Day_mean = mean(total),
             Day_sd = sd(total),
             Day_se = Day_sd/sqrt(Day_N),
            Day_cv = Day_sd/Day_mean )
Intra.assay_cv
# write_csv(Intra.assay_cv, "Intra.assay_cv.csv")

Inter assay variability

Inter.assay <- Intra.assay_cv %>% 
 summarise(Exp_N = length(Day_mean),
             Exp_mean = mean(Day_mean),
             Exp_sd = sd(Day_mean),
             Exp_se = Exp_sd/sqrt(Exp_N),
            Exp_cv = Exp_sd/Exp_mean )
Inter.assay
# write_csv(Inter.assay, "Inter.assay.csv")

Factor the data into categorical variables

# Refactoring Columns for samples
data2$Sample_ID <- as.factor(data2$Sample_ID)
data2$Dilution_factor <- as.numeric(data2$Dilution_factor)
data2$Injection<- as.factor(data2$Injection)
data2$Tech_rep <- as.numeric(data2$Tech_rep)


# Refactoring COlumns for timecourse
tc$Sample_ID <- as.factor(tc$Sample_ID)
tc$Day <- as.factor(tc$Day)
tc$Weight <- as.numeric(tc$Weight)
tc$TEI_Day <- as.factor(tc$TEI_Day)
tc1 <- tc %>% 
  select(Day:Pups)
tc1

Back calculate the original concentration of the sample

data2 <- data2 %>% 
  mutate(True_Count=Dilution_factor*Count)
data2

Average the three technical replicate readings

data3 <- data2 %>% 
  group_by(particle_size,Sample_ID,Dilution_factor,Injection) %>% 
  summarise( tech_N = length(True_Count),
             tech_mean = mean(True_Count),
             tech_sd = sd(True_Count),
             tech_se = tech_sd/sqrt(tech_N))
data3
test1 <- left_join(tc1,data3, by= "Sample_ID")

Summarize samples by injection (average both injections)

data4 <- data3 %>% 
  group_by(particle_size,Sample_ID,Dilution_factor) %>% 
  summarise( inj_N = length(tech_mean),
             inj_mean = mean(tech_mean),
             inj_sd = sd(tech_mean),
             inj_se = inj_sd/sqrt(inj_N))
data4
test2 <- left_join(tc1,data4, by= "Sample_ID")

test2

Quick visualizations

Graphing all samples

test1$Sample_ID_correct = factor(test1$Sample_ID, levels=c('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','70','73','74','75','76'))

graph1 <- test1 %>%
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=2.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nMouse Plasma Throughout Pregnancy")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct, nrow=7)

graph1

Looking at individual gestational day nanosight line plots

Virgin Mice

virgin_histogram <- test1 %>%
  filter(Day == '1') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nVirgin Mouse Plasma")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct)+
  geom_vline(xintercept = 140)+
  annotate("text", x= 235, y = 4E9, label= "140nm")

virgin_histogram

# ggsave(plot = virgin_histogram, "virgin_histogram.png",
#        height = 10, width = 14, dpi = 300, units= "in")

GD 5.5

gd5.5_histogram <- test1 %>%
  filter(Day == '5') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nGD 5.5 Mouse Plasma")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct)+
  geom_vline(xintercept = 140)+
  annotate("text", x= 235, y = 4E9, label= "140nm")

gd5.5_histogram

# ggsave(plot = gd5.5_histogram, "gd5.5_histogram.png",
#        height = 10, width = 14, dpi = 300, units= "in")

GD 10.5

gd10.5_histogram <- test1 %>%
  filter(Day == '10') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nGD 10.5 Mouse Plasma")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct)+
  geom_vline(xintercept = 140)+
  annotate("text", x= 235, y = 4E9, label= "140nm")

gd10.5_histogram

# ggsave(plot = gd10.5_histogram, "gd10.5_histogram.png",
#        height = 10, width = 14, dpi = 300, units= "in")

GD 14.5

gd14.5_histogram <- test1 %>%
  filter(Day == '14') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nGD 14.5 Mouse Plasma")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct)+
  geom_vline(xintercept = 140)+
  annotate("text", x= 235, y = 4E9, label= "140nm")


gd14.5_histogram

# ggsave(plot = gd14.5_histogram, "gd14.5_histogram.png",
#        height = 10, width = 14, dpi = 300, units= "in")

GD 17.5

gd17.5_histogram <- test1 %>%
  filter(Day == '17') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nGD 17.5 Mouse Plasma")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct)+
  geom_vline(xintercept = 140)+
  annotate("text", x= 235, y = 4E9, label= "140nm")


gd17.5_histogram

# ggsave(plot = gd17.5_histogram, "gd17.5_histogram.png",
#        height = 10, width = 14, dpi = 300, units= "in")

1 Day Post

one.day.post.partum_histogram <- test1 %>%
  filter(Day == '20') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se,
                  ymax=tech_mean+tech_se),
                  alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\n1 Day Post Partum Mouse Plasma")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~ Sample_ID_correct)+
  geom_vline(xintercept = 140)+
  annotate("text", x= 235, y = 4E9, label= "140nm")


one.day.post.partum_histogram

# ggsave(plot = one.day.post.partum_histogram, "one.day.post.partum_histogram.png",
#        height = 10, width = 14, dpi = 300, units= "in")

Graphing averaged samples by experimental day

graph2 <- test2 %>%
  group_by(TEI_Day) %>% 
  ggplot(aes(x=particle_size, y=inj_mean,color=Day ))+ #plot
  #geom_ribbon(aes(ymin=inj_mean-inj_se, ymax=inj_mean+inj_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=2) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size") + # X axis label
  ylab("\nMean Particle Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\nMouse Plasma Throughout Pregnancy")+ #title
  labs(color="Condition")+ #Label table title
  facet_wrap(~ TEI_Day, ncol=7)

graph2

### Particle concentration values for each of the 36 samples

test3 <- test2 %>% 
  group_by(Day,Sample_ID) %>% 
  summarise(particle_conc=sum(inj_mean))
test3
# write_csv(test3, "Sample_means.csv")

Boxplot of all values

plot1 <- test3 %>% 
  group_by(Day) %>% 
  ggplot(aes(x= Day, y = particle_conc/1E9, color=Day)) +
  geom_boxplot(colour="black",fill=NA) + 
  geom_point(aes(text = paste("Sample ID:", Sample_ID)),
             position='jitter',size=3)+
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nExosomes/ml\n") + # Y axis label
  ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy (All Samples)\n")+ #title
  labs(color="Condition")+ # Label table title
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
  
plot1

# ggsave("Exosome_plot.png", height = 5, width = 7, units = "in", dpi = 600)

We can see that there are outlier values for Virgin, GD 17 and 1 day post. For these box plots, the middle line represents the median (50th percentile), the lower line represents the 25th percentile and the upper line represents the 75th percentile. The whiskers extend from each end of the box and goes to the farthest nonoutlier point. Outliers are values that are greater than 1.5x the interquartile range from either edge of the box. ##Plotly of all values

  ggplotly(plot1)
## Warning: We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`

Boxplot without outliers

Samples 6, 26, 32 will be excluded because they are greater than 1.5x the interquartile range. Sample 28 did not have enough blood to be reanalyzed and was thu

plot1 <- test3 %>% 
  filter(!Sample_ID %in% c('6','26','28','32')) %>% 
  group_by(Day) %>% 
  ggplot(aes(x= Day, y = particle_conc/1E9, color=Day)) +
  geom_boxplot(colour="black",fill=NA) + 
  geom_point(aes(text = paste("Sample ID:", Sample_ID)),
             position='jitter',size=3)+
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nExosomes/ml\n") + # Y axis label
  ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
  labs(color="Condition")+ # Label table title
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
  
plot1

ggsave("Exosome_plot_new.png", height = 5, width = 7, units = "in", dpi = 600)

Plotly without outliers

  ggplotly(plot1)
## Warning: We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`

Summary statistics of particle concentration (averaging for each time point)

test4 <- test3 %>% 
  filter(!Sample_ID %in% c('6','26','28','32')) %>% #Removing outliers
  group_by(Day) %>% 
  summarise(Day_N=length(particle_conc),
            Day_mean = mean(particle_conc),
            Day_sd = sd(particle_conc),
            Day_se = Day_sd/sqrt(Day_N))
test4
# write_csv(test4,"Summary_statistics_for_each_GD.csv")

Bar plot

plot <- test4 %>% 
  ggplot(aes(x = Day, y = Day_mean))+ #plot
  geom_col()+
  geom_errorbar(aes(ymin = Day_mean-Day_se, ymax = Day_mean+Day_se), width=.4,
                size = 0.8, colour = "black", position = position_dodge(.9)) + #error bars
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nMean Concentration\n(Vesicles/ml)\n") + # Y axis label
  ggtitle("\nMouse Plasma Vesicle Concentration\nAcross Pregnancy\n")+ #title
  guides(fill=FALSE) + # Remove legend
  scale_y_continuous(breaks = seq(1E11,5E11,1E11),
                     limits = c(0,5E11),
                     expand=c(0,0))+ #set bottom of graph
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Rename bottom


plot

ggsave("Vesicle_barplot.png", height = 5, width = 7, units = "in", dpi = 600)

Looking at Variation between the days the samples were run

test7 <- test3 %>% 
  left_join(tc1)
## Joining, by = c("Day", "Sample_ID")
plot2 <- test7 %>%
  ggplot(aes(x = Day, y = particle_conc, color = Day, shape=TEI_Day))+
  geom_point(position= 'dodge',size=4)+
  scale_shape_manual(values=c(15,16,17,18,22,23,24,1))+
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nMean Concentration\n(Vesicles/ml)\n") + # Y axis label
  ggtitle("Mouse Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
  labs(color="Condition") + # Label table title
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post"))

plot2

ggplotly(plot2)
## Warning: We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
## Warning: Width not defined. Set with `position_dodge(width = ?)`

Statistics on ALL sizes

Shapiro test

tidy(shapiro.test(test3$particle_conc))

p value >0.05 therefore conclude data is normally distributed

ANOVA

jacob <-  test3 %>%  # Datset without outliers
  filter(!Sample_ID %in% c('6','26','28','32'))
         
fit <- aov(particle_conc ~ Day, data=jacob)
stats <- tidy(fit)
stats

Statistically significant, thus Tukey’s HSD post hoc analysis can determine significant differences.

Tukey Post Hoc Test

HSD <- TukeyHSD(fit)
tukey <- tidy(HSD)
tukey

Significant Tukey Post Hoc Test Values

tukey %>%
  filter(adj.p.value<0.05) %>% 
  arrange(adj.p.value)

Next we can filter on vesicles that are 140nm and smaller

nano_140 <- data4 %>% 
  filter(particle_size<140.5) %>% 
  left_join(tc1, by= "Sample_ID") %>% 
  group_by(Day,Sample_ID) %>% 
  summarise(particle_conc=sum(inj_mean)) %>% 
  filter(!Sample_ID %in% c('6','26','28','32'))

nano_140_plot <- nano_140 %>% 
  ggplot(aes(factor(Day),particle_conc, color=Day)) +
  geom_boxplot(colour="black",fill=NA) + 
  geom_point(aes(text = paste("Sample ID:", Sample_ID)),
             position='jitter',size=3)+
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nMean Exosome Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("\nExosome Concentration\nAcross Pregnancy\n")+ #title
  guides(fill=FALSE) + # Remove legend
  scale_y_continuous(breaks = seq(1E11,5E11,1E11),
                     limits = c(0,5E11),
                     expand=c(0,0))+ #set bottom of graph
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Rename bottom

nano_140_plot 

ggplotly(nano_140_plot)
## Warning: We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
nano_140_bar <- nano_140 %>% 
  group_by(Day) %>% 
  summarise(N    = length(particle_conc),
            mean = mean(particle_conc),
            sd   = sd(particle_conc),
            se   = sd/sqrt(N)) %>% 
  ggplot(aes(x= factor(Day),y = mean, fill=Day)) +
  geom_col()+
  geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=.5, 
                size=0.8, colour="black", position=position_dodge(.9)) + #error bars
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("\nPlasma Exosome Concentration\nAcross Pregnancy\n")+ #title
  guides(fill=FALSE) + # Remove legend
  scale_y_continuous(breaks = seq(1E11,5E11,1E11),
                     limits = c(0,4E11),
                     expand=c(0,0))+ #set bottom of graph
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_fill_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Rename bottom

nano_140_bar 

ggsave("Exosome_barplot.png", height = 5, width = 7, units = "in", dpi = 600)

Statistics on Exosomes only (140nm)

Shapiro test

tidy(shapiro.test(nano_140$particle_conc))

p value >0.05 therefore conclude data is normally distributed

ANOVA

exo_fit <- aov(particle_conc ~ Day, data=nano_140)
exo_stats <- tidy(exo_fit)
exo_stats

Statistically significant, thus Tukey’s HSD post hoc analysis can determine significant differences.

Tukey Post Hoc Test

exo_HSD <- TukeyHSD(exo_fit)
exo_tukey <- tidy(exo_HSD)
exo_tukey

Significant Tukey Post Hoc Test Values

exo_tukey %>%
  filter(adj.p.value<0.05) %>% 
  arrange(adj.p.value)
test8 <- test7 %>% 
  filter(!Day == "20" & !Sample_ID == '70')

fit <- lm(particle_conc ~ Weight ,data = test8)

summary(fit)
## 
## Call:
## lm(formula = particle_conc ~ Weight, data = test8)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -2.613e+11 -7.290e+10 -3.068e+10  9.558e+10  2.215e+11 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept) 3.154e+10  9.155e+10   0.344   0.7327  
## Weight      9.357e+09  3.537e+09   2.646   0.0125 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.176e+11 on 32 degrees of freedom
## Multiple R-squared:  0.1795, Adjusted R-squared:  0.1539 
## F-statistic: 7.001 on 1 and 32 DF,  p-value: 0.01253
tidy(summary(fit))
test7 %>% 
  ggplot(aes(x= Weight, y = particle_conc))+
  geom_point()+
  geom_smooth()+
  xlab("\nWeight (g)\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Linear Regression of Exosome \nConcentration vs. Weight")+ #title
  labs(color="Day")#Label table title
## `geom_smooth()` using method = 'loess'

test7 %>% 
  filter(!Sample_ID == '70') %>% 
  ggplot(aes(x= Weight, y = particle_conc))+
  geom_point(size = 3,aes(color=factor(Day)))+
  geom_smooth(method = "lm", level = 0.95)+
  xlab("\nWeight (g)\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Linear Regression of Exosome \nConcentration vs. Weight")+ #title
  labs(color="Day")#Label table title

test7 %>% 
  ggplot(aes(x= Pups, y = particle_conc))+
  geom_point(size = 4, aes(color=factor(Day)))+
  #geom_smooth(method = "lm", level = 0.95)+
  scale_x_continuous(breaks=seq(0,12,2))+
  xlab("\nNumbwe of Pups\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Linear Regression of Exosome \nConcentration vs. Number of Pups")+ #title
  labs(color="Day")#Label table title

mean_placenta <- tc %>% 
  #filter(Day %in% c('10','14','17') & !Sample_ID %in% c('70','73','74','75')) %>%
  select(-(TEI_Day:Pup_right),-Resorp) %>% 
  gather("Placenta_avg","Plac_weight", 3:5) %>%
  group_by(Day,Sample_ID) %>% 
  summarise(N = length(Plac_weight),
            mean_plac = mean(Plac_weight*1000, na.rm = TRUE), #convert g to mg
            sd = sd(Plac_weight)*1000,  #convert g to mg
            se = sd/sqrt(N))

mean_placenta %>% 
  inner_join(test7) %>% 
  ggplot(aes(x= mean_plac, y = particle_conc))+
  geom_point(size= 3,aes(color=factor(Day)))+
  geom_smooth(method = "lm", level = 0.95)+
  xlab("\nPlacental Weight (mg)\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
  labs(color="G.D.")#Label table title
## Joining, by = c("Day", "Sample_ID")
## Warning in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factor and character vector, coercing into character vector
## Warning: Removed 23 rows containing non-finite values (stat_smooth).
## Warning: Removed 23 rows containing missing values (geom_point).

plac_weight <- mean_placenta %>% 
  inner_join(test7) %>% 
  filter(Day %in% c('10','14','17'))
## Joining, by = c("Day", "Sample_ID")
## Warning in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factor and character vector, coercing into character vector
summary(lm(particle_conc ~ mean_plac, data=plac_weight))
## 
## Call:
## lm(formula = particle_conc ~ mean_plac, data = plac_weight)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -2.467e+11 -8.755e+10  1.229e+10  9.380e+10  2.299e+11 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)  
## (Intercept) 1.964e+11  6.896e+10   2.848   0.0116 *
## mean_plac   1.879e+09  9.205e+08   2.041   0.0581 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.246e+11 on 16 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.2066, Adjusted R-squared:  0.157 
## F-statistic: 4.167 on 1 and 16 DF,  p-value: 0.05808
mean_placenta %>% 
  inner_join(test7) %>% 
  ggplot(aes(x = Pups, y = particle_conc))+
  geom_point(size= 3,aes(color=factor(Day)))+
  geom_smooth(method = "lm", se= FALSE)+
  facet_wrap(~Day)+
  scale_x_continuous(breaks=seq(1,12,2))+
  xlab("\nNumbr of Pups\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
  labs(color="G.D.")#Label table title
## Joining, by = c("Day", "Sample_ID")
## Warning in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y): joining
## factor and character vector, coercing into character vector

test3 %>% 
  filter(!Day %in% c('1','20')) %>% 
  group_by(Day) %>% 
  ggplot(aes(factor(Day),particle_conc, color=Day)) +
  geom_point(size=3)+
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
  labs(color="Condition")#Label table title

nanosight_plot <- test1 %>%
  filter(Sample_ID == '75') %>% 
  ggplot(aes(x=particle_size, y=tech_mean,color=Injection ))+ #plot
  geom_ribbon(aes(ymin=tech_mean-tech_se, ymax=tech_mean+tech_se),alpha=0.2,fill = alpha('grey12', 0.2)) + #error bars
  geom_line(size=1.0) + xlim(0,500)+ #line size, x-axis scale
  scale_y_continuous(expand=c(0,0))+ #set bottom of graph
  xlab("Particle Size (nm)") + # X axis label
  ylab("\nMean Concentration\n(Particles/ml)\n") + # Y axis label
  ggtitle("Nanosight Histogram of\n100nm Bead Standards")+ #title
  labs(color="Injection")+ #Label table title
  facet_wrap( ~Injection)

nanosight_plot
## Warning: Removed 1000 rows containing missing values (geom_path).

ggsave("Nanosight_plot.png", height = 5, width = 7, units = "in", dpi = 600)
## Warning: Removed 1000 rows containing missing values (geom_path).
 test3 %>% 
  filter(!Sample_ID %in% c('1','6','15','16','19','24','29','6','28','32')) %>% 
  group_by(Day) %>% 
  ggplot(aes(x= Day, y = particle_conc, color=Day)) +
  geom_boxplot(colour="black",fill=NA) + 
  geom_point(aes(text = paste("Sample ID:", Sample_ID)),
             position='jitter',size=3)+
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nMean Exosomes Concentration\n(Exosomes/ml)\n") + # Y axis label
  ggtitle("Plasma Exosome Concentration\nThroughout Pregnancy\n")+ #title
  labs(color="Condition")+ # Label table title
  scale_x_discrete(breaks=c("1","5","10","14","17","20"),  # Change X axis label
                   labels=c("Virgin","5","10","14","17","1 Day Post")) +
  scale_color_discrete(labels=c("Virgin","5","10","14","17","1 Day Post")) # Change Legend
## Warning: Ignoring unknown aesthetics: text

 filtered_data <- test3 %>% 
  filter(!Sample_ID %in% c('1','6','15','16','19','24','29','6','28','32'))


filtered_fit <- aov(particle_conc ~ Day, data=filtered_data)
filtered_stats <- tidy(filtered_fit)
filtered_stats
filtered_HSD <- TukeyHSD(filtered_fit)
filtered_tukey <- tidy(filtered_HSD)

filtered_tukey %>% 
  filter(adj.p.value < 0.05) %>% 
  arrange(adj.p.value)

Mean placenta weight

mean_placenta %>% 
  group_by(Day) %>% 
  summarise(mean_N   = length(mean_plac),
            day_mean = mean(mean_plac),
            day_sd   = sd(mean_plac),
            day_se   = day_sd/sqrt(mean_N)) %>% 
  ggplot(aes(x = Day, y = day_mean, fill = Day))+
  geom_bar(stat="identity")+
  geom_errorbar(aes(ymin = day_mean-day_se, ymax = day_mean+day_se), width=.5, 
                size=0.8, colour="black", position=position_dodge(.9)) + #error bars
  scale_y_continuous(breaks = seq(0,125,25),
                     limits = c(0,125),
                     expand = c(0,0))+ #set bottom of graph and scale
  xlab("\nDay of Gestation\n") + # X axis label
  ylab("\nWeight (mg)\n") + # Y axis label
  ggtitle("Mouse Placental Weight\nThroughout Pregnancy\n")+ #title
  labs(fill="Gestational Day") # Label table title
## Warning: Removed 5 rows containing missing values (position_stack).
## Warning: Removed 5 rows containing missing values (geom_errorbar).